<template>
  <div class="login">
    <van-nav-bar @click-right="onClickRight">
      <template #right>
        <van-icon name="cross" size="18" />
      </template>
    </van-nav-bar>
    <img src="https://www.pmdaniu.com/storages/85894/de8ed605c628e9854b208f2fdb1c3254-40104/images/%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC/u7309.svg" alt="">
    <van-form @submit="onSubmit">
      <van-field
        v-model="phone"
        name="手机号"
        label="手机号:"
        placeholder="请填写手机号"
      />
      <van-field
        v-model="password"
        type="password"
        name="密码"
        label="密码:"
        placeholder="请填写密码"
      />
      <!-- <router-link to="/forget" class="forget">忘记密码</router-link> -->
      <van-checkbox class="agree" v-model="checked"  icon-size="15px">
          已阅读并同意《
          <router-link class="agreement" to="/agreement">用户服务协议</router-link>
          》
        </van-checkbox>
      <div style="margin: 16px;">
        <van-button color="linear-gradient(to left, #ff6034, #ee0a24)" round block type="info" native-type="submit">登录</van-button>
      </div>
    </van-form>
    <router-link to="/registered" class="create">创建账号</router-link>
  </div>
</template>

<script>
import Login from '@/utils/login'
export default {
  name: 'Login',
  data () {
    return {
      phone: '',
      password: '',
      checked: false
    }
  },
  methods: {
    // 点击，返回上一页
    // onClickLeft () {
    //   this.$router.back() // 编程式导航
    // },
    onClickRight () {
      this.$router.back() // 编程式导航
    },
    onSubmit (values) {
      Login(this.checked, this.phone, this.password)
      console.log('submit', Login)
    }
  }
}
</script>

<style lang="less" scoped>
  .login{
    img{
      display: block;
      margin: 40px auto;
    }
    .forget{
      display: block;
      float: right;
      font-size: 13px;
      color: #000;
      text-decoration: none;
      margin-top: 30px;
      margin-right: 30px;
    }
    .agree{
      font-size: 15px;
      display: flex;
      justify-content: center;
      margin: 30px auto;
      .agreement{
        color: #3498DB;
      }
    }
    .create{
      display: block;
      // width: 80px;
      // height: 30px;
      margin: 0 auto;
      text-align: center;
      font-size: 15px;
      text-decoration: none;
      color: #FC7A77;
    }
  }
</style>
